package com.cinsea.mobile.ext;

import com.alibaba.fastjson.JSON;
import com.cinsea.common.ExtAction;
import com.cinsea.util.StringUtil;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * User: xf
 * Date: 13-12-21
 * Time: 下午1:16
 */
public class MenuAction extends ExtAction {
    @Override
    public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        String action = StringUtil.null2String(request.getParameter("action"));
        if (action.equals("getmenu")) {//xyc
            Map menu1 = new HashMap();
            menu1.put("text", "养护管理");
            ArrayList menu1childs = new ArrayList();
            menu1.put("items", menu1childs);

            Map menu11 = new HashMap();
            menu11.put("text", "换花");
            menu11.put("leaf", true);
            Map menu12 = new HashMap();
            menu12.put("text", "换花车");
            menu12.put("leaf", true);
            Map menu13 = new HashMap();
            menu13.put("text", "签收单");
            menu13.put("leaf", true);
            menu1childs.add(menu11);
            menu1childs.add(menu12);
            menu1childs.add(menu13);
            Map menu2 = new HashMap();
            menu2.put("text", "采购管理");
            ArrayList menu2childs = new ArrayList();
            menu2.put("items", menu2childs);
            Map menu21 = new HashMap();
            menu21.put("text", "待采购清单");
            menu21.put("leaf", true);
            Map menu22 = new HashMap();
            menu22.put("text", "采购汇总表");
            menu22.put("leaf", true);
            Map menu23 = new HashMap();
            menu23.put("text", "送货确认单");
            ArrayList menu21childs = new ArrayList();
            menu23.put("items",menu21childs);
            Map menu231 = new HashMap();
            menu231.put("text", "换花确认单");
            menu231.put("leaf", true);
            Map menu232 = new HashMap();
            menu232.put("text", "赠/售花确认单");
            menu232.put("leaf", true);
            menu21childs.add(menu231);
            menu21childs.add(menu232);
            menu2childs.add(menu21);
            menu2childs.add(menu22);
            menu2childs.add(menu23);
            Map root = new HashMap();
            ArrayList rootchilds = new ArrayList();
            rootchilds.add(menu1);
            rootchilds.add(menu2);
            root.put("items", rootchilds);
            gzip(request,response,JSON.toJSONString(root));
        }
        
        
    }
}
